package io.renren.modules.generator.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.generator.dao.WebContentDao;
import io.renren.modules.generator.entity.WebContentEntity;
import io.renren.modules.generator.service.WebContentService;


@Service("webContentService")
public class WebContentServiceImpl extends ServiceImpl<WebContentDao, WebContentEntity> implements WebContentService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = (String) params.get("key");
        IPage<WebContentEntity> page = this.page(
                new Query<WebContentEntity>().getPage(params),
                new QueryWrapper<WebContentEntity>().like(StringUtils.isNotBlank(key),"content_type_name",key)
        );

        return new PageUtils(page);
    }

}